package com.sumainfor.pc.gmio.controller.MktFeign;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.PageUtils;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.pc.gmio.service.impl.HouOwcontactService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/1/17 16:58
 * @Description:
 */
@RestController
@RequestMapping("/key/HouOwContact")
public class HouOwContactController {

    @Autowired
    HouOwcontactService houOwcontactService;

    /**
     * 功能描述:
     * 根据房源编号查询业主联系人变更列表
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/1/17 17:02
     */
    @GetMapping("/getHouOwcontactList")
    public JsonResult getHouOwcontactList(@RequestParam Map<String,Object> params, Pager pager){
        JsonResult result=new JsonResult();
        params.put("delfg",0);
        pager.setPagerNecessary(params, pager);
        PageUtils pageUtils = new PageUtils();
        Integer count=houOwcontactService.getHouOwcontactListCount(params);
        if(count==0){
            return pageUtils.getJsonResult(new ArrayList<Map<String,Object>>(), params,count);
        }
        List<Map<String,Object>> getHouOwcontactList=houOwcontactService.getHouOwcontactList(params);
        result=pageUtils.getJsonResult(getHouOwcontactList, params, count);
        return result;
    }

    /**
     * 功能描述:
     * 根据房源编号查询业主收款人变更列表
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/1/17 17:02
     */
    @GetMapping("/getHouOwPayeeList")
    public JsonResult getHouOwPayeeList(@RequestParam Map<String,Object> params, Pager pager){
        JsonResult result=new JsonResult();
        params.put("delfg",0);
        pager.setPagerNecessary(params, pager);
        PageUtils pageUtils = new PageUtils();
        Integer count=houOwcontactService.getHouOwPayeeListCount(params);
        if(count==0){
            return pageUtils.getJsonResult(new ArrayList<Map<String,Object>>(), params,count);
        }
        List<Map<String,Object>> getHouOwPayeeList=houOwcontactService.getHouOwPayeeList(params);
        result=pageUtils.getJsonResult(getHouOwPayeeList, params, count);
        return result;
    }
}
